Recently there is a Web site project requirements: the need to block domestic requests. Take the time to study the information in this area. The best way to find it now is to use the Nginx GeoIP module to realize the region's identification. Then
This article mainly introduces the use of GeoIP Library instances in php. This article provides code instances subdivided into countries and cities, for more information, see maxmind, which is the provider of the geoip database,
Sample and api
This article mainly introduces the use of GeoIP Library instances in php. This article provides code instances subdivided into countries and cities, for more information, see maxmind, which is the provider of the geoip database,
Sample and api
Transferred from: http://www.21andy.com/blog/20100405/1799.html
There are 2 standard methods of using GeoIP
The first method:Download the GeoIP data file first
Wget-c
It is important to note that Maxmind is the provider of the GeoIP database,
Sample and API documentation are also available in many languages.
For example, PHP, and PHP GeoIP library is very different, including the use of the interface
It should be noted that Maxmind is the provider of the GeoIP database,It also provides sample and API documentation for many languages.For example, PHP, and PHP GeoIP library is very different, including the use of the interface function.The
1.
CD geoip/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip-d GeoIP.dat.gz
ls
GeoLiteCity.dat
Other libraries: viewing
http://dev.maxmind.com/zh-hans/geoip/legacy/geolite/
2.
wget
GeoIP database: http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz.First, download the required resources on the Maxmind websiteAfter downloading, we unzip it to D disk, specific installation document see GeoIP Legacy
There are many databases for geographic location query, most of which are available in free versions. There are pure databases in China, but they only provide the geographical location information of text and do not provide latitude and longitude
Use MaxMind to locate visitors based on IP addresses. Sometimes you need to know the country in which your site visitors come from-for example, if you are planning to launch an advertising program for a geographical region. This document introduces
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.